package com.jxnd.sunflower.config;

import org.springframework.stereotype.Component;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @author: 敷衍
 * @description:
 * @date: 2021/12/8 19:46
 * @version: 1.0
 */
@Component
public class AlipayConfig {

    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号 按照我文章图上的信息填写
    public static String app_id = "2016110200785809";

    // 商户私钥，您的PKCS8格式RSA2私钥  刚刚生成的私钥直接复制填写
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7RHS/AwwvuHspdBee+KfXuewK7dP5CFcQ0/m7Pn5exGEogajdd/tUebB3p2jTRURYBYaMa61/RPFgLttbw9jHkGbnYoPMRUPVndFyYb1G9J5jKZuElp+rqgYo5XIfXTLRVOPxaSvOkjBfhfMuAUEBflEdD755b94ceX1sijGUIMX83H5RVxAkdtB+WKFcSSkkLgs20mhzAwDZepvqJ+urEOkZa19w9L1pfssWh+8I0ldDGnCIRVhEPjyPuaBnitipqbkUhjLQ+uNtHnSfKyJSV9gcj4Cf1jWtfXWLAbFO9pJyAKariawfX04Y3BqF5YEv/RSLyZfMzZkZNhRcwucNAgMBAAECggEAMQK5i0RA7Dxb/31isThitRLzs+iKkaKdJspTka3JZQQAaZmFmHDOVk2C4c3uoVx/honrrNSBk813XrTktB+NnK0uQWCHHe8C0eV763OpFejviwRYr1q8bzEQa6OhOpQpuJ9/CK99x5J7FoT4IBIz8TAeCn0UXLPqbYleSgng7+MxPMWzdVIusOfdkM62vHOBb92xPX7iWkM9I4DS8dD9DSkox40yI8gyZcUWWIhwJvyyO06Jn7Cu+tjLonm53sXKORWyOhWPnqtJhiXajmqPS2zvnOHsUKRY4RRYTqbN9tYcZEhQkd1v9/s5equv4F9EQ/vc9YWBIO4bqOmJfV70AQKBgQDjf0lBgMqVRhkuLpVHo+hYIN1QxR4OGk1UZhbVCkJAbynfV1TlQ9+AYPi0u1Osnwli2g95Lx2Bld3L0gE0lvHmeLp+N282wnTGapvKLgyBEvVP96GW4PrGkSyoxY9/bbYqENarm/Vky9x4hlotpZgB/Qxi2matkYQUYCrOEXnbGwKBgQDSutg/wS5UnRLpG4Ul+LPz1At1QyKu/HJ1bLvMziqzYYqIE25ztrhAKwn3WNWQCKNTGMrkglCxu6JBDOyJD6W1EtidBCNB9rgj6ew1H9lpCfLYPIxXy/tKuym8Apf6CNUiu1zGIf88f8MNIEf6Eb+TsBKXKi948QeorYD4VxmA9wKBgAL3yyXen0X5RyTSGMJ5gfN8YkbGe5DliPK77jpTSu/6Q0qVohbnnsfW/AenlfzfikjO3XrQQYtKQD2DfN6JxZgjJRO2d234dXuNMoEdvq4EaEzlxybnwn3KsRF2mluoO8MquxI8E6SAAF1WK2EDEwubmIjFnqdPCbEWXBiaI8PXAoGARTFitjRpUREuV2pY4unxtJsok/1SUyDDOHlWhN4hOTtK8Hlo6AfUIgW/xP7fSOb9MdjPLg74DhPtJ+zlce+4WmdwxsXICe3H8srpa1wk2A+TNJtU/bMVtSkVgA1d95SU302kHc6l7yiIVDQITj0rqYPD5uzMH6sM977YvTJkRmsCgYEAwn4D8tdt/ytkW/s6yaWUhimHfvjMcc+q2kp6cr1e1YTfxzmVfXc8cn9f7JYBfUPdZXtmIKZDDVrE9mtOpkqihEYykpIzM3VIz7xf7rocA9amHd6KZtbr4n6bz/RJcNM1WsxSJobVQhlgCfV2uGWqLk60tTCUbvyo/8JJ/5Uu5VE=";

    // 支付宝公钥,对应APPID下的支付宝公钥。 按照我文章图上的信息填写支付宝公钥，别填成商户公钥
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqNsn+GKmaBpkDN7Yo4h065LB7QFPfEoLliObnuG9sVOSOauxaFTz3tQNhRhWqumFwrNwRY8f/56fZiTRfP8yEdEu93V2nM/zoBJbemgN2tH1xI9I3i7CTjYXqFK4AN3WZ7tI7vER1VLCFZYRNMG7VRzL6oUo/vLwLDrvRv+hQmxvpfCsforn/H9Sn43IMiNWB7uBF2TKXW73MRQ1kt4kpT6Tho007a24iLkrziR5bcdZ95AANifsdQhCsLouKyn+pQtsQdO5jzEXHuwtpqGJkxO8J4kQXdNNxwXg6KbhxsYqdzB1DTgUJrZf69szfLrSG2Ip4j/S9VieWnNsSfq3WwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，其实就是你的一个支付完成后返回的页面URL
    public static String notify_url = "http://localhost:9999/alipay/notifyurl";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，其实就是你的一个支付完成后返回的页面URL
    public static String return_url = "http://localhost:9999/orders/addOrders";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

}
